from graphics_utilities import *
from general_utilities import *
#from powers import *

class Basic_object_info:
  def __init__(self,
               name,description,
               slot,
               powers_granted,
               tile_xy,new_tileset=0, 
               from_col=None,to_col=None,
               stealth_boost=0,speed_boost=0,armor_boost=0,magic_resistance_boost=0,
               mp_regeneration_boost=0,fire_resistance=0,protected_from_missiles=0,poisoned_melee_weapon=0,dragon_slayer=1,
               xp_boost=0,melee_damage_boost=0,water_walking=0,
               consumable=0,drinkable=0,
               is_key=0,
               is_chest_of_size=0,is_chest_of_quality=0,
               quality=0,never_randomly_dropped=0,level=1,always_useful=0,common=0,rare=0):
    self.name = name 
    self.description = description
    self.tile_xy = tile_xy
    self.new_tileset = new_tileset
    self.slot = slot # a SL_ code as above
    self.powers_granted = powers_granted
    self.stealth_boost = stealth_boost
    self.speed_boost = speed_boost
    self.magic_resistance_boost = magic_resistance_boost
    self.armor_boost = armor_boost
    self.mp_regeneration_boost = mp_regeneration_boost
    self.xp_boost = xp_boost
    self.melee_damage_boost = melee_damage_boost
    self.protected_from_missiles = protected_from_missiles
    self.poisoned_melee_weapon = poisoned_melee_weapon
    self.dragon_slayer = dragon_slayer
    self.water_walking = water_walking
    self.fire_resistance = fire_resistance
    self.consumable = consumable
    self.drinkable = drinkable
    self.is_key = is_key
    self.is_chest_of_size = is_chest_of_size
    self.is_chest_of_quality = is_chest_of_quality
    self.quality = quality
    self.never_randomly_dropped = never_randomly_dropped
    self.always_useful = always_useful
    self.common = common
    self.rare = rare
    self.level = level
    self.from_col = from_col
    self.to_col = to_col
    self.tile, self.tile_on_black, self.big_tile_on_black = None, None, None # fill these in later

class Garb_info(Basic_object_info):
  # pass armor,speed,magic_resistance,stealth,role,possible powers (a [P_]) but not slot or description
  def __init__(self,armor,speed,magic_resistance,stealth,role,possible_powers,powers_granted=None,**parms): 
    Basic_object_info.__init__(self,slot=SL_GARB,always_useful=1,description="Wear this to begin training as a " + role_texts[role] + "!\nAs time goes by, you will learn the powers of your new class.",powers_granted=powers_granted,**parms) 
    self.armor, self.speed, self.magic_resistance, self.stealth, self.role = armor, speed, magic_resistance, stealth, role
    self.possible_powers = possible_powers

class Missile_weapon_info(Basic_object_info):
  # pass damage but not slot
  def __init__(self,damage,fire_arrows=0,powers_granted=None,hit_bonus=0,**parms): 
    Basic_object_info.__init__(self,slot=SL_MISSILE,powers_granted=powers_granted,**parms) 
    self.damage = damage
    self.hit_bonus = hit_bonus
    self.fire_arrows = fire_arrows
    
class Wand_info(Basic_object_info):
  # pass damage but not slot
  def __init__(self,powers_granted,hit_bonus=0,**parms): 
    Basic_object_info.__init__(self,slot=SL_MISSILE,powers_granted=powers_granted,**parms) 
    self.hit_bonus = hit_bonus
    self.damage = 0 # should never be called
    self.fire_arrows = 0
    
class Melee_weapon_info(Basic_object_info):
  # pass damage but not slot
  def __init__(self,damage,admonish_on_hit=0,regain_mp_on_kill=0,powers_granted=None,**parms): 
    Basic_object_info.__init__(self,slot=SL_MELEE,powers_granted=powers_granted,**parms) 
    self.damage = damage    
    self.admonish_on_hit = admonish_on_hit
    self.regain_mp_on_kill = regain_mp_on_kill

class Money_info(Basic_object_info):
  # never carried, always go to score on pickup
  def __init__(self,value,**parms): 
    Basic_object_info.__init__(self,slot=SL_MONEY,always_useful=1,powers_granted=None,**parms) 
    self.value = value 
    
class Food_info(Basic_object_info):
  # never carried, always go to hp on pickup
  def __init__(self,hp,**parms): 
    Basic_object_info.__init__(self,slot=SL_FOOD,always_useful=1,powers_granted=None,**parms) 
    self.hp = hp     

class Potion_info(Basic_object_info):
  def __init__(self,**parms): 
    Basic_object_info.__init__(self,slot=SL_POTION,consumable=1,drinkable=1,always_useful=1,powers_granted=None,**parms) 
      # Effects will be resolved on consumption through the Entity.consume function

class Key_info(Basic_object_info):
  def __init__(self,**parms): 
    Basic_object_info.__init__(self,slot=SL_KEY,always_useful=1,description="This key will unlock a door somewhere in this dungeon. You'll know it when you see it - every locked door shows the picture of the key that can open it. The key will be no use if you leave this dungeon before finding the door - in which case it will quietly disappear.",powers_granted=None,is_key=1,**parms) 

class Boots_info(Basic_object_info):
  def __init__(self,powers_granted=None,**parms): 
    Basic_object_info.__init__(self,slot=SL_BOOTS,powers_granted=powers_granted,**parms) 
    
class Amulet_info(Basic_object_info):
  def __init__(self,powers_granted=None,**parms): 
    Basic_object_info.__init__(self,slot=SL_AMULET,powers_granted=powers_granted,**parms) 

class Ring_info(Basic_object_info):
  def __init__(self,powers_granted=None,**parms): 
    Basic_object_info.__init__(self,slot=SL_RING,powers_granted=powers_granted,**parms) 

class Object_library:
  def __init__(self):
    self.o = {} # key is O_ code, value is derived from Basic_object_info
    self.add_item(O_G_WARRIOR, Garb_info(name="Warrior Chainmail",
                                         role=R_WARRIOR,
                                         tile_xy=(43,0),
                                         quality=1,
                                         rare=1,
                                         level=2,
                                         possible_powers=[P_SMITE,P_CLEAVE,P_JAB,P_ALL_OUT_DEFENSE,P_FIGHTING_WITHDRAWAL,P_CHARGE],
                                         speed = 10,
                                         armor = 15,
                                         magic_resistance = 6,
                                         stealth = 9))
    self.add_item(O_G_MAGE, Garb_info(name="Mage Robe",
                                      role=R_MAGE,
                                      tile_xy=(34,0),
                                      quality=1,
                                      rare=1,
                                      level=2,
                                      possible_powers=[P_BLINK,P_TELEPORTATION,P_FIREBOLT,P_CONFUSION,P_LIGHTNING_BOLT,P_CLAIRVOYANCE],
                                      speed = 10,
                                      armor = 7,
                                      magic_resistance = 13,
                                      stealth = 10))
    self.add_item(O_G_PRIEST, Garb_info(name="Priest Vestments",
                                        role=R_PRIEST,
                                        tile_xy=(7,0),
                                        quality=1,
                                        rare=1,
                                        level=2,      
                                        possible_powers=[P_EXORCISM,P_HEALING,P_CIRCLE_OF_PROTECTION,P_ADMONISHMENT,P_WALK_THROUGH_FIRE,P_DETECT_ENEMIES],
                                        speed = 8,
                                        armor = 12,
                                        magic_resistance = 12,
                                        stealth = 8))
    self.add_item(O_G_ROGUE, Garb_info(name="Rogue Tunic",
                                       role=R_ROGUE,
                                       tile_xy=(33,0), 
                                       quality=1,
                                       rare=1,
                                       level=2,
                                       possible_powers=[P_EASY_JUMP,P_LONG_JUMP,P_DODGE,P_PICK_LOCKS,P_DOUBLE_SHOT,P_SNEAK],
                                       from_col=purple,
                                       to_col=green,
                                       speed = 13,
                                       armor = 7,
                                       magic_resistance = 7,
                                       stealth = 13))
    self.add_item(O_G_UNDEAD_SLAYER, Garb_info(name="Undead Slayer Cloak",
                                               role=R_UNDEAD_SLAYER,
                                               tile_xy=(7,0),
                                               from_col=very_light_grey,
                                               to_col=brown,
                                               possible_powers=[P_LONG_JUMP,P_PICK_LOCKS,P_EXORCISM,P_CIRCLE_OF_PROTECTION],
                                               level=4,
                                               quality=1,
                                               rare=1,
                                               speed = 12,
                                               armor = 12,
                                               magic_resistance = 12,
                                               stealth = 16))
    self.add_item(O_G_WARLOCK, Garb_info(name="Warlock Hauberk",
                                         role=R_WARLOCK,
                                         tile_xy=(49,0),
                                         possible_powers=[P_JAB,P_CLEAVE,P_CLAIRVOYANCE,P_FIREBOLT,P_CIRCLE_OF_FIRE,P_WINDBLAST],
                                         from_col=light_grey,
                                         to_col=purple,
                                         level=4,
                                         quality=1,
                                         rare=1,
                                         speed = 12,
                                         armor = 14,
                                         magic_resistance = 14,
                                         stealth = 12))
    self.add_item(O_G_TRICKSTER, Garb_info(name="Trickster Costume",
                                           role=R_TRICKSTER,
                                           tile_xy=(5,3),
                                           new_tileset=1,
                                           from_col=dark_purple,
                                           to_col=orange,
                                           possible_powers=[P_BLINK,P_CONFUSION,P_DODGE,P_SNEAK],
                                           level=4,
                                           quality=1,
                                           rare=1,
                                           speed = 15,
                                           armor = 9,
                                           magic_resistance = 15,
                                           stealth = 13))
    self.add_item(O_G_CRUSADER, Garb_info(name="Crusader Surcoat",
                                          role=R_CRUSADER,
                                          tile_xy=(6,3),
                                          new_tileset=1,
                                          from_col=light_grey,
                                          to_col=white,
                                          possible_powers=[P_SMITE,P_CHARGE,P_HEALING,P_ADMONISHMENT],
                                          level=4,
                                          quality=1,
                                          rare=1,
                                          speed = 12,
                                          armor = 15,
                                          magic_resistance = 16,
                                          stealth = 9))
    self.add_item(O_SHORTSWORD, Melee_weapon_info(name="Shortsword",
                                                  tile_xy=(3,10),
                                                  damage=4, 
                                                  description="It'll do for slicing bread and opening letters, but not much more than that. Find a better weapon as soon as you can - and a bow wouldn't go amiss, either!"))
    self.add_item(O_SWORD, Melee_weapon_info(name="Sword",
                                             tile_xy=(10,10),
                                             damage=7, 
                                             level=2,
                                             description="A sturdy and serviceable sword, with a few nicks in the edge."))
    self.add_item(O_AXE, Melee_weapon_info(name="Axe",
                                           tile_xy=(35,10),
                                           damage=6, 
                                           level=3,
                                           powers_granted=[P_CLEAVE],
                                           description="A hefty axe, good for chopping wood - or goblins!"))
    self.add_item(O_SPEAR, Melee_weapon_info(name="Spear",
                                             tile_xy=(28,10),
                                             damage=6, 
                                             level=3,
                                             powers_granted=[P_JAB],
                                             description="A long spear, such as peasants use to defend their village."))
    self.add_item(O_MACE, Melee_weapon_info(name="Mace",
                                            tile_xy=(20,10),
                                            level=3,
                                            damage=6, 
                                            powers_granted=[P_SMITE],
                                            description="A heavy weapon with a solid iron ball on the end, very suitable for chastizing evildoers."))
    self.add_item(O_STAFF, Melee_weapon_info(name="Staff",
                                             tile_xy=(18,9),
                                             level=3,
                                             damage=4, 
                                             mp_regeneration_boost=0.3,
                                             description="A long oaken quarterstaff. Not the most effective weapon, but favored by mages - the staff is a good support for walking long distances and helps you regain your magic faster."))
    self.add_item(O_WARLOCK_SWORD, Melee_weapon_info(name="Warlock Sword", # in actions.py, gain energy on kill
                                                     regain_mp_on_kill=1,
                                                     quality=1,
                                                     level=5,
                                                     tile_xy=(11,10),
                                                     damage=9, 
                                                     mp_regeneration_boost=0.3,
                                                     description="A wizard's weapon, this sorcerous blade will not only help you slay your enemies but will also boost your flagging magical energies whenever it takes a life."))         
    self.add_item(O_GREAT_AXE, Melee_weapon_info(name="Great Axe",
                                                 tile_xy=(36,10),
                                                 quality=1,
                                                 level=4,
                                                 damage=11, 
                                                 powers_granted=[P_CLEAVE,P_SMITE],
                                                 description="This huge and brutal war axe inflicts truly horrific injuries!"))
    self.add_item(O_FLAIL, Melee_weapon_info(name="Flail", 
                                             quality=1,
                                             level=4,
                                             admonish_on_hit=1,
                                             tile_xy=(23,10),
                                             damage=9, 
                                             description="This stern priest's weapon will cause holy dread among your foes!"))
    self.add_item(O_TROLLISH_SHORTSWORD, Melee_weapon_info(name="Trollish Shortsword", 
                                                           tile_xy=(4,10),
                                                           quality=1,
                                                           level=4,
                                                           damage=9, 
                                                           stealth_boost=3,
                                                           description="A vicious weapon. Trolls pad about sneakily on their great flat feet, awaiting a chance to slit throats with a short blade like this!\nIt will improve your stealth and is effective at close quarters."))
    self.add_item(O_POISONED_DAGGER, Melee_weapon_info(name="Poisoned Dagger", 
                                                       tile_xy=(3,10),
                                                       from_col=dark_grey,
                                                       to_col=green,
                                                       damage=4, 
                                                       level=3,
                                                       poisoned_melee_weapon=1,
                                                       stealth_boost=1,
                                                       description="This vicious little dagger's blade has been dipped in something nasty. It will deliver your foes a lingering death, if it can penetrate their armour."))
    self.add_item(O_HOLY_SWORD, Melee_weapon_info(name="Blessed Blade", 
                                                  tile_xy=(13,10),
                                                  damage=10,
                                                  quality=1,
                                                  level=5,
                                                  powers_granted=[P_SMITE,P_CIRCLE_OF_PROTECTION],
                                                  description="This holy weapon has been blessed by a saint. Its pommel is forged in the shape of a cross."))
    self.add_item(O_DRAGON_SLAYER, Melee_weapon_info(name="Dragon Slayer", 
                                                     tile_xy=(16,10),
                                                     damage=10,
                                                     dragon_slayer=1,
                                                     never_randomly_dropped=1,
                                                     description="The weapon of a fallen hero, its blade is enscribed with ancient runes, which foretell the defeat of the dragon. But whoever it was that first wielded it, it was not his fate to slay the Firedrake - will it be yours?"))
    self.add_item(O_STAFF_OF_HEALING, Melee_weapon_info(name="Staff of Healing",
                                                        tile_xy=(11,9),
                                                        damage=6,
                                                        quality=1,
                                                        level=3,
                                                        mp_regeneration_boost=0.5,
                                                        powers_granted=[P_HEALING],
                                                        description="This staff is of white wood - two carved snakes entwine about it. It will grant you powers to heal and mend."))
    self.add_item(O_STAFF_UNDEAD_TURNING, Melee_weapon_info(name="Staff of Undead Turning",
                                                            tile_xy=(13,9),
                                                            damage=6,
                                                            quality=1,
                                                            level=4,
                                                            mp_regeneration_boost=0.5,
                                                            powers_granted=[P_EXORCISM],
                                                            description="A soft glow radiates from this holy staff. It will grant you powers against the unliving."))
    self.add_item(O_BOW, Missile_weapon_info(name="Bow",
                                             tile_xy=(43,10),
                                             damage=5, 
                                             level=2,
                                             description="A bow, you can use this to shoot enemies at long range."))
    self.add_item(O_CROSSBOW, Missile_weapon_info(name="Crossbow",
                                                  tile_xy=(45,10),
                                                  damage=9, 
                                                  level=3,
                                                  hit_bonus = -0.2,
                                                  description="The crossbow is a little inaccurate, but quite powerful - its quarrels can easily punch through armor."))
    self.add_item(O_ELVEN_BOW, Missile_weapon_info(name="Elven Bow",
                                                   tile_xy=(44,10),
                                                   quality=1,
                                                   level=4,                                                   
                                                   from_col=red,
                                                   to_col=green,
                                                   damage=7, 
                                                   hit_bonus=0.3,
                                                   description="The arrows of the elves seldom miss their targets."))
    self.add_item(O_SPEED_BOW, Missile_weapon_info(name="Bow of Speed",
                                                   quality=1,
                                                   level=5,
                                                   tile_xy=(43,10),
                                                   from_col=brown,
                                                   to_col=blue,
                                                   damage=6, 
                                                   powers_granted=[P_DOUBLE_SHOT],
                                                   hit_bonus=0.1,
                                                   description="This magical bow allows you to shoot off many arrows very rapidly!"))
    self.add_item(O_FIRE_BOW, Missile_weapon_info(name="Bow and Flaming Arrows",
                                                  quality=1,
                                                  level=4,
                                                  fire_arrows=1,
                                                  tile_xy=(44,10),
                                                  damage=7,
                                                  hit_bonus=0.1,
                                                  description="This bow shoots fire-arrows, which catch aflame as they fly through the air! Very effective (except against enemies who are impervious to fire!)"))
    self.add_item(O_WAND, Wand_info(name="Wand",
                                    tile_xy=(2,9),
                                    level=2,
                                    powers_granted=[P_ZAP],
                                    mp_regeneration_boost = 0.3,
                                    description="Like Harry Potter, you can zap people from across the room."))
    self.add_item(O_FIRE_WAND, Wand_info(name="Wand of Fire",
                                         tile_xy=(8,9),
                                         quality=1,
                                         level=4,
                                         powers_granted=[P_ZAP,P_FIREBOLT],
                                         mp_regeneration_boost = 0.5,
                                         description="More powerful than the basic apprentice wand, this turbocharged version allows you to zap bolts of fire."))
    self.add_item(O_LIGHTNING_WAND, Wand_info(name="Wand of Lightning",
                                              quality=1,
                                              level=5,
                                              tile_xy=(7,9),
                                              powers_granted=[P_ZAP,P_LIGHTNING_BOLT],
                                              mp_regeneration_boost = 0.5,
                                              description="Never point this at someone unless you mean to kill them!"))
    self.add_item(O_DIVINER_WAND, Wand_info(name="Diviner's Wand",
                                            quality=1,
                                            level=3,
                                            tile_xy=(8,9),
                                            from_col=yellow,
                                            to_col=green,
                                            powers_granted=[P_ZAP,P_DETECT_ENEMIES],
                                            mp_regeneration_boost = 0.5,
                                            description="Not only is this a magical weapon, but you can use it to cast simple Divination spells."))
    self.add_item(O_ELVEN_BOOTS, Boots_info(name="Elven Boots",
                                            tile_xy=(19,0),
                                            quality=1,
                                            level=3,
                                            stealth_boost=3,
                                            speed_boost=1,
                                            description="Elven boots confer phenomenal stealth to the wearer, allowing them to glide through the dungeon as softly as an elf through the wood."))
    self.add_item(O_JUMPING_BOOTS, Boots_info(name="Jumping Boots",
                                              tile_xy=(19,0),
                                              quality=1,
                                              level=3,
                                              from_col=green,
                                              to_col=red,
                                              powers_granted=[P_EASY_JUMP,P_LONG_JUMP],
                                              speed_boost=1,
                                              description="These magical boots turn you into a champion long-jumper! In fact, you can barely stop jumping for a minute!"))
    self.add_item(O_SPEED_BOOTS, Boots_info(name="Boots of Speed",
                                            tile_xy=(19,0),
                                            from_col=green,
                                            to_col=yellow,
                                            powers_granted=[P_EASY_JUMP],
                                            speed_boost=4,
                                            quality=1,
                                            level=4,
                                            description="These magical boots give you a winged stride, allowing you to run much faster."))
    self.add_item(O_WATER_WALKING_BOOTS, Boots_info(name="Water Walking Boots",
                                                    tile_xy=(19,0),
                                                    from_col=green,
                                                    to_col=blue,
                                                    water_walking=1,
                                                    quality=1,
                                                    level=4,
                                                    description="These fantastic boots allow you to walk on water! (Just don't try to sit down for a rest while you're halfway across...)"))
    self.add_item(O_BOOTS, Boots_info(name="Boots",
                                      tile_xy=(20,0),
                                      speed_boost=1,
                                      level=2,
                                      description="A stout pair of boots, they will keep your feet dry and comfortable."))
    self.add_item(O_SHOES, Boots_info(name="Shoes",
                                      tile_xy=(7,3),
                                      level=2,
                                      new_tileset=1,
                                      stealth_boost=1,
                                      description="A pair of light leather shoes with soft soles."))
    self.add_item(O_GAUNTLETS_OF_POWER, Basic_object_info(name="Gauntlets of Power",
                                                          tile_xy=(26,0),
                                                          slot=SL_GLOVES,
                                                          quality=1,
                                                          level=4,
                                                          rare=1,
                                                          melee_damage_boost=2,
                                                          powers_granted=[P_SMITE],
                                                          description="These magical gloves will double your strength! Make sure not to pick your nose while wearing them or you could be seriously injured"))
    self.add_item(O_CHEST_SMALL, Basic_object_info(name="Small chest",
                                                   is_chest_of_size=2,
                                                   is_chest_of_quality=2,
                                                   level=2,
                                                   common=1,
                                                   tile_xy=(0,7),
                                                   slot=SL_MISC_ITEM,
                                                   powers_granted=None,
                                                   description="A treasure chest! What (if anything) is inside this little casket...?"))
    self.add_item(O_YOU_SKELETON, Basic_object_info(name="Skeleton",
                                                    tile_xy=(47,7),
                                                    level=2,
                                                    common=1,
                                                    slot=SL_MISC_ITEM,
                                                    powers_granted=None,
                                                    description="A human skeleton..."))
    self.add_item(O_ORB_LIFE, Basic_object_info(name="Orb of Life",
                                                tile_xy=(41,5),
                                                never_randomly_dropped=1,
                                                powers_granted=None,
                                                slot=SL_MISC_ITEM,
                                                description="The fabled Orb of Life!"))
    self.add_item(O_COPPER, Money_info(name="Copper coins",
                                       tile_xy=(7,7),
                                       level=1,
                                       common=1,
                                       value=1,
                                       description="Copper coins, only enough to buy a loaf of bread."))
    self.add_item(O_SILVER, Money_info(name="Silver coins",
                                       tile_xy=(8,7),
                                       level=2,
                                       common=1,
                                       value=5,
                                       description="Silver coins, enough to buy a suit of clothes."))
    self.add_item(O_GOLD, Money_info(name="Gold coins",
                                     tile_xy=(9,7),
                                     level=3,
                                     common=1,
                                     value=20,
                                     description="Gold coins, enough to buy a fine horse!"))
    self.add_item(O_GEMS, Money_info(name="Gems",
                                     level=4,
                                     tile_xy=(16,7),
                                     value=40,
                                     description="Precious gems and jewels, grab them quickly!") )
    self.add_item(O_SMALL_FOOD, Food_info(name="Food Ration",
                                          level=2,
                                          common=1,
                                          tile_xy=(6,2),
                                          hp=10,
                                          description="An unappetizing but nourishing meal.")   ) 
    self.add_item(O_BIG_FOOD, Food_info(name="Banquet",
                                        tile_xy=(4,2),
                                        level=3,
                                        hp=30,
                                        quality=1,
                                        description="A feast fit for a hungry hero!"))
    self.add_item(O_KEY_GOLD, Key_info(name="Gold Key", 
                                       tile_xy=(8,3),
                                       new_tileset=1)) # Special sort - gold key locks can never be picked
    self.add_item(O_KEY_SILVER, Key_info(name="Silver Key", 
                                         tile_xy=(8,3),
                                         from_col=yellow,
                                         to_col=light_grey,  
                                         new_tileset=1))
    self.add_item(O_KEY_RED, Key_info(name="Red Key", 
                                       tile_xy=(5,4),
                                       new_tileset=1))
    self.add_item(O_KEY_BLUE, Key_info(name="Blue Key", 
                                       tile_xy=(5,4),
                                       from_col=red,
                                       to_col=blue,  
                                       new_tileset=1))
    self.add_item(O_KEY_GREEN, Key_info(name="Green Key", 
                                        tile_xy=(5,4),
                                        from_col=red,
                                        to_col=green,  
                                        new_tileset=1))
    self.add_item(O_HEALING_POT, Potion_info(name="Potion of Healing",
                                             level=3,
                                             tile_xy=(41,8),
                                             description="This potion will cure your wounds."))
    self.add_item(O_MAGIC_POT, Potion_info(name="Potion of Magic",
                                           level=2,
                                           common=1,
                                           tile_xy=(15,8),
                                           description="This potion will restore your magical energies."))
    self.add_item(O_ANTIDOTE_POT, Potion_info(name="Universal Antidote",
                                              level=2,
                                              tile_xy=(27,8),
                                              description="This potion will cure all forms of poison."))
    self.add_item(O_FIRERES_POT, Potion_info(name="Potion of Fire Resistance",
                                             tile_xy=(13,8),
                                             level=3,
                                             common=1,
                                             description="This potion protects you from heat and flame. After you have drunk it, you can thrust your hands into boiling oil without getting burned!"))
    self.add_item(O_STONESKIN_POT, Potion_info(name="Stoneskin Potion",
                                               level=4,
                                               tile_xy=(7,8),
                                               description="This potion will temporarily transform your skin into a thick grey protective coating. This protects you from blows and heat, but does slow you down somewhat."))
    self.add_item(O_BLINK_POT, Potion_info(name="Dust of Disappearance",
                                           level=4,
                                           tile_xy=(44,8),
                                           description="A magical dust used by thieves to escape the scene of the crime!"))    
    self.add_item(O_CHAMELEON_POT, Potion_info(name="Oil of Blending",
                                               level=3,
                                               tile_xy=(4,8),
                                               description="This unguent will help you blend into the background. Use it before exploring a new area, to prevent the monsters from noticing you."))
    self.add_item(O_AMULET_FIRERES, Amulet_info(name="Amulet against Fire",
                                                tile_xy=(34,5),
                                                quality=1,
                                                level=4,
                                                fire_resistance=1,
                                                description="This talisman will help to protect you from heat and flames."))
    self.add_item(O_AMULET_PROTECTION, Amulet_info(name="Amulet against Blows",
                                                   tile_xy=(32,5),
                                                   quality=1,
                                                   level=3,
                                                   armor_boost=3,
                                                   description="This talisman will help to protect you from melee attacks."))
    self.add_item(O_AMULET_MAGICRES, Amulet_info(name="Amulet against Sorcery",
                                                 magic_resistance_boost=3,
                                                 level=4,
                                                 quality=1,
                                                 tile_xy=(38,5),
                                                 description="This talisman will help to protect you from magical attacks."))
    self.add_item(O_AMULET_MISSILERES, Amulet_info(name="Amulet against Missiles",
                                                   tile_xy=(36,5),
                                                   quality=1,
                                                   level=3,
                                                   protected_from_missiles=1, 
                                                   description="This talisman will help to protect you from arrows, stones and other missiles."))
    self.add_item(O_RING_COMBAT, Ring_info(name="Ring of Combat",
                                           quality=1,
                                           level=4,
                                           rare=1,
                                           tile_xy=(15,5),
                                           melee_damage_boost=3,
                                           description="This magic ring will strengthen your blows in melee combat."))
    self.add_item(O_RING_KNOWLEDGE, Ring_info(name="Ring of Knowledge",
                                              quality=1,
                                              level=4,
                                              rare=1,
                                              tile_xy=(13,5),
                                              xp_boost=0.3,
                                              description="This powerful magic ring brings you knowledge, hastening your progress in your chosen profession."))
    self.add_item(O_RING_MAGIC, Ring_info(name="Ring of Magic",
                                          quality=1,
                                          level=4,
                                          rare=1,
                                          tile_xy=(17,5),
                                          mp_regeneration_boost = 0.5,
                                          description="This sorcerer's ring will be a powerful new source of magical energy for you."))
    
  def add_item(self,type,definition):
    self.o[type] = definition
    self.o[type].type = type
    
    
olib = Object_library()

